1. Field of the Invention
Embodiments of the present invention generally relate to computer graphics, and more particularly to anisotropic filtering of texture data.
2. Description of the Related Art
Conventional graphics processors are exemplified by systems and methods developed to read and filter texture map samples. To simplify the texture map filtering performed within a graphics processor, a texture is prefiltered and various resolutions forming an image pyramid or “mipmap” are stored. FIG. 1A is a conceptual diagram of prior art showing the levels of a mipmapped texture including the finest level, level 101, and successively lower resolution levels, 102, 103, and 104. In some systems, mipmap levels are numbered such that level 0 is the highest resolution, “base” level, and level k is half the size in each dimension of level k−1, for all k up to the apex of the pyramid.
The region in texture space corresponding to a pixel is called the pixel's “footprint”. A pixel can be approximated with a circle in screen space. For texture mapping of two-dimensional textures, the corresponding footprint in texture space can be approximated by an ellipse. In classic use of mipmaps, a mipmap level is chosen so that the footprint when scaled to that level is about 1 texel (texture pixel) in diameter. Then a bilinear filter is used to interpolate between the values of four texels forming a 2×2 square around the footprint center, to produce a bilinear texture sample. This is called isotropic filtering, because it filters equally in the two texture space dimensions, u and v. Although the filter yielding excellent image quality, the ideal filter, has an approximately elliptical shape, isotropic filtering approximates the ellipse with a circle, to simplify the texture sampling and filtering computations. Therefore, portions of the footprint are not sampled, resulting in visual artifacts caused by undersampling.
In FIG. 1A, a footprint 115 is a pixel footprint in texture space, with a position 135 being the footprint center. FIG. 1B illustrates a prior art application of texture level 101 applied to pixels of a surface 140 that is receding in image space. When viewed in image space, footprint 115 (an ellipse) appears as circle 116. All ellipses have a largest diameter, called the major axis, and a smallest diameter, called the minor axis. Isotropic filtering yields high quality images for pixels whose footprints have major and minor texture axes that are similar in length. But texture stretching, oblique viewing, and perspective can cause footprints to be very elongated, such as footprint 115. When isotropic filtering is used in such situations, a circle is not a good approximation of an ellipse. If the circle is too small (diameter close to the minor axis), the filter is too sharp, too few texels are averaged, and aliasing results. If the circle is too large (diameter close to the major axis), the filter is too broad, too many texels are averaged, and blurring results. Anisotropic texture filtering addresses this problem by using a filter that more closely matches the elliptical shape of the ideal filter.
FIG. 1C illustrates footprint 115 including a minor axis 125 that is significantly shorter than a major axis 130. Texture samples along major axis 130, the axis of anisotropy, are read from one or more mipmap levels and are blended to produce a pixel color. The level from which the samples are read is determined using a level of detail (LOD) value which is nominally the log base 2 of the length of minor axis 125. The number of texture samples read from the texture map is determined based on the ratio of the major axis to the minor axis, the anisotropic ratio, with more texture samples needed as the ratio increases, i.e. as the ellipse becomes more elongated.
When the LOD value lies between two integers, texture samples from two different LOD mip maps, a coarse and a fine mip map, are used to produce an anisotropically filtered texture value for the footprint. The coarse mip map has a lower resolution compared with the fine mip map. Increasing the LOD value effectively increases the diameter of each bilinear texture sample since texels are read from a lower resolution mipmap. Bilinear samples from the two LODs are combined based on the fractional portion of the LOD to produce an anisotropically filtered texture sample corresponding to pixel 116.
FIG. 1D illustrates a prior art application of ten bilinear samples, bilinear samples 140, that are positioned along major axis 130 to approximate an elliptical footprint for a coarse LOD mip map, such as footprint 115. Each bilinear sample corresponds to an isotropically filtered texture sample for an LOD of a texture map that is computed using conventional bilinear isotropic filtering. Each bilinear sample of bilinear samples 140 is spaced less than one texel apart. In some conventional systems, the bilinear samples in the coarse LOD are spaced by 0.5 to 1.0 texels apart. Therefore the coarse LOD mip map is oversampled, possibly introducing visual artifacts and requiring more computations and texel reads than if the spacing were one texel apart.
FIG. 1E illustrates a prior art application of bilinear samples, bilinear samples 150, that are positioned along major axis 130 to approximate an elliptical footprint for a fine LOD mip map, such as footprint 115. Each bilinear sample of bilinear samples 140 is spaced more than one texel apart. Therefore the fine LOD mip map is undersampled. The undersampling resulting from a spacing between one and two texels is generally considered to produce images of acceptable quality. Therefore, unlike the coarse LOD, fewer texel reads and computations are used to produce a filtered texture value for the fine LOD.
Accordingly, there is a desire to improve texture mapping performance by reducing the number of bilinear texture samples used to perform anisotropic texture mapping. Reducing the number of samples while maintaining an acceptable level of image quality may result in performance improvements due to fewer texel reads and filtering computations.